$co-external-link-padding-right: 15px;

dl.co-inline {
  dd {
    margin-bottom: 1em;
  }
  dt {
    float: left;
    margin-right: 0.4em;
  }
}

.co-m-pane__body {
  margin: $grid-gutter-width 0 0;
  padding: 0 ($grid-gutter-width / 2) $grid-gutter-width;
  @media (min-width: $screen-sm-min) {
    padding-left: $grid-gutter-width;
    padding-right: $grid-gutter-width;
  }
  &--no-top-margin {
    margin-top: 0;
  }
  &--section-heading {
    padding-bottom: 0;
  }
  + .co-m-pane__body {
    border-top: 1px solid $color-grey-background-border;
    margin-top: 0;
    padding-top: $grid-gutter-width;
  }
}

.co-m-pane__createLink--no-title {
  margin-bottom: $grid-gutter-width;
}

.co-m-pane__filter-bar,
.co-m-pane__help-text {
  margin: 20px ($grid-gutter-width / 2);
  @media (min-width: $grid-float-breakpoint) {
    margin-left: $grid-gutter-width;
    margin-right: $grid-gutter-width;
    margin-top: $grid-gutter-width;
  }
}

.co-m-pane__filter-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  .btn-group,
  .co-m-primary-action,
  .pf-c-form-control {
    margin-bottom: 10px;
  }
  .btn-group {
    margin-right: 10px;
    min-width: 0; // enables truncation of selected item, if needed
  }
}

.co-m-pane__filter-bar-group {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  min-width: 0;
}

.co-m-pane__filter-bar-group--filter {
  @media (min-width: $screen-xs-min) {
    flex: 1 0 auto;
    justify-content: flex-end;
  }
}

// Use to left align content filters that aren't using .pf-c-toolbar
.co-m-pane__filter-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  margin-bottom: $grid-gutter-width;
}

.co-m-pane__filter-row-action {
  padding-top: ($grid-gutter-width / 2);
  @media (min-width: $screen-xs-min) {
    padding-top: 0;
  }
}

.co-m-pane__heading {
  display: flex;
  justify-content: space-between;
  margin: 0 0 $grid-gutter-width;
  &--baseline {
    align-items: baseline;
  }
  &--center {
    justify-content: center;
  }
  &--logo {
    align-items: center;
    margin-bottom: ($grid-gutter-width / 2);
  }
}

.co-m-pane__heading-badge {
  line-height: 0;
  @media (min-width: $screen-sm-min) {
    margin-left: var(--pf-global--spacer--sm);
  }
}

.co-m-pane__heading-owner {
  display: block;
  font-size: $font-size-base;
  line-height: var(--pf-global--LineHeight--md);
  padding-top: var(--pf-global--spacer--sm);
  span {
    display: inline;
  }
}

.co-m-pane__heading-link {
  font-size: $font-size-base;
}

.co-inline-block {
  display: inline-block;
}

.co-no-bold {
  font-weight: var(--pf-global--FontWeight--normal);
}

.cos-error-title {
  color: $color-pf-red;
}

.co-section-heading {
  display: flex;
  justify-content: space-between;
  margin: 0 0 20px 0;
}

.co-section-heading--breadcrumbs {
  margin-bottom: 0;
}

.co-section-heading__title {
  font-size: 18px;
  margin: 0 0 20px 0;
}

.co-section-heading-secondary {
  font-size: 16px;
  margin: 30px 0;
}

.co-section-heading-tertiary {
  font-size: 16px;
  margin: 15px 0;
}

.co-table-container {
  overflow: auto;
  margin-bottom: 30px;
}

.co-m-pane__details {
  // TODO: refactor so <dl>s have margin-bottom by default
  margin-bottom: 20px;
  min-width: 0; // enable break-word
  white-space: normal; // override inheritence from co-detail-table
  .co-detail-table__row & {
    margin-bottom: 0;
  }
  dd {
    @include co-break-word;
  }
}

.co-m-pane__dropdown {
  margin-bottom: 20px;
}

.co-m-pane__explanation {
  color: $color-pf-black-600;
  margin-bottom: 30px;
}

.co-m-pane__explanation--alt {
  margin-bottom: 20px;
}

// PatternFly lacks the ability to have a plain button variant without padding
.co-help-popover-button {
  padding: 0 !important;

  &--space-l {
    margin-left: 0.35em;
  }
}

.co-help-text {
  color: $color-pf-black-600;
}

.co-m-pane__explanation code {
  background-color: $color-pf-black-150;
  color: $color-pf-black-600;
}

.co-pre-line {
  white-space: pre-line;
}

.co-pre-wrap {
  white-space: pre-wrap;
}

// Prevent iOS phones from zooming on form inputs
@supports (-webkit-overflow-scrolling: touch) {
  // Target mobile Safari
  @media (max-width: $grid-float-breakpoint-max) {
    // Target phones
    input,
    select,
    .tag-item,
    textarea {
      font-size: 16px !important;
    }
  }
}

.co-error {
  color: $color-pf-red;
  white-space: nowrap;
}

.error-message {
  color: #fff;
  padding: 2px 12px;
  background-color: #d64456;
}

.co-action-divider {
  color: $color-pf-black-600;
  display: inline-block;
  margin: 0 10px 0 10px;
}

.co-break-word {
  @include co-break-word;
}

// Prefer `co-break-word` in most cases. `co-break-all` should generally be reserved for URLs and long,
// unbroken identifiers.
.co-break-all {
  word-break: break-all;
}

// append external-link icon to <a> so that it doesn't wrap without text
// there must be no white space between the text and the closing </a> tag holding the pseudo element
.co-external-link:after {
  @include font-awesome-free-solid;
  content: fa-content($fa-var-external-link-alt);
  font-size: 75%;
  height: 16px;
  margin-left: 3px;
  margin-right: -15px; // width + margin-left
  position: relative;
  top: 0;
  width: 12px;
  .pf-c-dropdown__menu-item & {
    color: $color-pf-black-600;
    margin-left: 5px;
  }
  .pf-c-nav__link & {
    color: $color-pf-black-500;
    margin-left: 4px;
  }
}
.co-external-link {
  display: inline-block;
  padding-right: $co-external-link-padding-right;
}
// Enable break word within co-m-table-grid
.co-external-link--block {
  display: block;
}

.co-icon-flex-child {
  flex: 0 0 auto;
  position: relative;
  top: 0.125em;
}

.co-line-clamp {
  @include co-line-clamp;
}

.co-sidebar-dismiss {
  padding: 0 5px;

  .close {
    font-size: 16px;
    // adjustments to increase click target and default color contrast because it's on a grey background
    opacity: 0.3;
    padding: 10px 15px;

    &:hover,
    &:focus {
      opacity: 0.6;
    }
  }
}

.co-toolbar {
  align-items: stretch;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  margin-bottom: 5px;
}

.co-toolbar__item {
  max-width: 100%;
  padding: 5px 0;
  .btn-group {
    max-width: 100%;
  }
}

.co-toolbar__group {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  min-width: 0;

  @media (max-width: $screen-xs-max) {
    flex-direction: column;
    justify-content: flex-end;
  }
}

.co-toolbar__group--left {
  justify-content: flex-start;
  .co-toolbar__item {
    padding-right: 15px;
  }
  @media (max-width: $screen-xs-max) {
    align-items: flex-start;
  }
}

.co-toolbar__group--right {
  justify-content: flex-end;
  @media (min-width: $screen-xs-min) {
    .co-toolbar__item {
      padding-left: 15px;
    }
  }
  @media (max-width: $screen-xs-max) {
    align-items: flex-end;
  }
}

.co-component-label {
  color: $color-pf-black-600;
  text-transform: uppercase;
  font-size: ($font-size-base - 1);
}

.co-legend {
  border-bottom: 0;
  font-weight: var(--pf-global--FontWeight--bold);
  font-size: $font-size-base;
  margin-bottom: 5px;

  + .radio {
    margin-top: 0;
  }
}

.help-block {
  margin-bottom: 0;
}

// Note: include .co-select-to-copy to enable single click selection of full text
.co-truncate {
  @include co-truncate;
}

.co-select-to-copy {
  cursor: copy;
  user-select: all;
  -moz-user-select: all;
  -webkit-user-select: all;
}

.co-nowrap {
  white-space: nowrap;
}

.co-an-fade-in-out {
  transition-duration: compact(0.2s, false, false, false, false, false, false, false, false, false);
  transition-property: compact(
    opacity,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false
  );
  transition-timing-function: compact(
    linear,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false,
    false
  );
}

.co-m-radio-desc {
  margin-left: 20px;
}

.co-m-form-row {
  margin-bottom: 20px;
}

.co-m-form-row:last-child {
  margin-bottom: 0;
}

.co-m-form-col {
  max-width: 600px;
}

// Enable word-break and append pencil icon ::after so that it doesn't wrap without text
.co-modal-btn-link {
  outline: none;
  padding: 0 20px 0 0;
  white-space: normal;
  word-break: break-all; // Firefox
  word-break: break-word;
  &::after {
    @include font-awesome-free-solid;
    color: $color-pf-black-600;
    content: fa-content($fa-var-pencil-alt);
    line-height: 1;
    margin-left: 5px;
    margin-right: -20px; // width + margin-left
    pointer-events: none;
    position: relative;
    right: 0;
    width: 15px;
  }
  &:hover::after {
    color: $color-pf-black-700;
  }
}

.co-modal-btn-link--inline {
  margin: 0 8px;
}

.co-modal-btn-link--left {
  text-align: left;
}

.co-m-pane__body-group {
  padding: 0 0 30px 0;
}

.co-m-table-grid {
  &__body {
    min-height: 50px;
    position: relative;
    width: 100%;
    .row {
      padding: 10px 20px 10px 0; // right padding creates space for .co-resource-kebab
    }
  }
  &__head {
    font-weight: var(--pf-global--FontWeight--bold);
    padding: 0 20px 10px 0; // right padding to maintain alignment with __body .row
    a {
      cursor: pointer;
    }
  }
  &__sort-arrow {
    margin-left: 10px;
  }
  &__sort-link--unsorted {
    color: $color-text-secondary;
  }
  &--bordered {
    .co-m-table-grid__body .row,
    .co-m-table-grid__head {
      border-bottom: solid 1px #eee;
    }
  }
  .row {
    vertical-align: middle;
    position: relative;
  }
  .co-m-table-grid {
    padding-left: 20px;
  }
  .row {
    line-height: normal;
    margin: 0;
  }
}

.co-m-row:hover {
  background-color: $color-co-m-row-hover;
}

.co-m-loader {
  min-width: 18px;
}

.co-m-loader-dot__one,
.co-m-loader-dot__two,
.co-m-loader-dot__three {
  animation-delay: 0;
  animation-direction: normal;
  animation-duration: 1s;
  animation-fill-mode: forwards;
  animation-iteration-count: infinite;
  animation-name: bouncedelay;
  animation-play-state: running;
  animation-timing-function: ease-in-out;
  background: #419eda;
  border-radius: 100%;
  display: inline-block;
  height: 6px;
  width: 6px;
}

.co-m-loader-dot__one {
  animation-delay: -0.32s;
}

.co-m-loader-dot__two {
  animation-delay: -0.16s;
}

@keyframes bouncedelay {
  0%,
  80%,
  100% {
    transform: scale(0.25, 0.25);
  }
  40% {
    transform: scale(1, 1);
  }
}

.co-kebab {
  &__button {
    border: 0; // remove so that dropdown-kebab-pf <button class="btn-link"> are aligned whether disabled or not
    padding: 0;

    &[disabled] {
      color: $color-pf-black-300 !important;
    }
  }
}

.no-margin {
  margin: 0 !important;
}
